package com.appwoo.txtws.activity;

import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.text.Html;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.TextView;
import com.appwoo.android.activity.BaseActivity;
import com.appwoo.txtws.bean.ServerAppBean;
import com.appwoo.txtws.component.DBHelper;
import com.appwoo.txtws.component.GetDateTime;
import com.appwoo.txtws.component.Global;
import com.appwoo.txtws.component.Logger;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;

public class RecordDateActivity extends BaseActivity
  implements View.OnClickListener
{
  private String RecordTypeJBCX = "";
  private ServerAppBean appBean;
  private Button buttonSub;
  private DatePicker datePicker;
  private String f_date = "";
  private String f_webType = "";
  private long imgDays;
  private String nowDate;
  private long recordDays;
  private TextView textview_record_blk;
  private TextView textview_record_text_fir;
  private TextView textview_record_tip;

  private void init()
  {
    this.textview_record_tip = ((TextView)findViewById(2131493375));
    this.textview_record_text_fir = ((TextView)findViewById(2131493371));
    this.textview_record_blk = ((TextView)findViewById(2131493372));
    this.buttonSub = ((Button)findViewById(2131493374));
    this.datePicker = ((DatePicker)findViewById(2131493373));
    this.appBean = ((ServerAppBean)getApplication());
    this.textview_record_blk.setText(Html.fromHtml("<u>" + getString(2131427597) + "</u>"));
    try
    {
      this.imgDays = 3L;
      this.recordDays = 3L;
      this.nowDate = this.appBean.getNowDate();
      this.nowDate = this.nowDate.substring(0, this.nowDate.indexOf(" "));
      this.RecordTypeJBCX = getIntent().getExtras().getString("RecordTypeJBCX");
      if ("0".equals(this.RecordTypeJBCX))
      {
        SpannableStringBuilder localSpannableStringBuilder1 = new SpannableStringBuilder(getString(2131427811) + " " + this.recordDays + " " + getString(2131427812));
        localSpannableStringBuilder1.setSpan(new ForegroundColorSpan(-256), 0, 4, 33);
        this.textview_record_tip.setText(localSpannableStringBuilder1);
        this.textview_record_text_fir.setText(getString(2131427813));
        this.textview_record_blk.setVisibility(0);
        return;
      }
    }
    catch (Exception localException)
    {
      while (true)
      {
        this.imgDays = 3L;
        this.recordDays = 3L;
        this.nowDate = GetDateTime.getDate();
      }
      if ("1".equals(this.RecordTypeJBCX))
      {
        SpannableStringBuilder localSpannableStringBuilder2 = new SpannableStringBuilder(getString(2131427811) + " " + this.recordDays + " " + getString(2131427812));
        localSpannableStringBuilder2.setSpan(new ForegroundColorSpan(-256), 0, 4, 33);
        this.textview_record_tip.setText(localSpannableStringBuilder2);
        this.textview_record_text_fir.setText(getString(2131427814));
        this.textview_record_blk.setVisibility(0);
        return;
      }
      SpannableStringBuilder localSpannableStringBuilder3 = new SpannableStringBuilder(getString(2131427811) + " " + this.imgDays + " " + getString(2131427812));
      localSpannableStringBuilder3.setSpan(new ForegroundColorSpan(-256), 0, 4, 33);
      this.textview_record_tip.setText(localSpannableStringBuilder3);
      this.textview_record_text_fir.setText(getString(2131427815));
      this.textview_record_blk.setVisibility(4);
    }
  }

  private void setLissenter()
  {
    this.buttonSub.setOnClickListener(this);
    this.textview_record_blk.setOnClickListener(this);
  }

  public long differDay(String paramString)
  {
    SimpleDateFormat localSimpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
    try
    {
      long l = (localSimpleDateFormat.parse(this.nowDate).getTime() - localSimpleDateFormat.parse(paramString).getTime()) / 86400000L;
      return l;
    }
    catch (ParseException localParseException)
    {
      localParseException.printStackTrace();
    }
    return 0L;
  }

  public void onBackPressed()
  {
    super.onBackPressed();
    IntentActivity(this, MainTabActivity.class);
    finish();
  }

  public void onClick(View paramView)
  {
    if (paramView == this.buttonSub)
      if (getSharedPreferences("equipname", 0).getString("equiptype", "PC").equals("Android"))
        alertMessage(getString(2131427816));
    while (paramView != this.textview_record_blk)
    {
      return;
      Bundle localBundle2 = getIntent().getExtras();
      this.RecordTypeJBCX = localBundle2.getString("RecordTypeJBCX");
      this.f_date = (this.datePicker.getYear() + "-" + (1 + Integer.valueOf(this.datePicker.getMonth()).intValue()) + "-" + this.datePicker.getDayOfMonth());
      Logger.e("tag", differDay(this.f_date) + "天");
      Logger.i("TXTW", "f_date()==" + this.f_date);
      long l = differDay(this.f_date);
      if (this.RecordTypeJBCX.equals("0"))
      {
        if ((l < this.recordDays) && (l > -1L))
        {
          this.f_webType = localBundle2.getString("webType");
          Bundle localBundle5 = new Bundle();
          localBundle5.putString("webType", this.f_webType);
          localBundle5.putString("date", this.f_date);
          new DBHelper(this).insertModuleAccess(Global.ManageUserName, Global.getIMEI(this), getResources().getStringArray(2131165194)[0], getResources().getStringArray(2131165194)[1]);
          IntentActivity(this, RecordWebUrlActivity.class, localBundle5);
          return;
        }
        alertMessage(getString(2131427817) + " " + this.recordDays + " " + getString(2131427812));
        return;
      }
      if (this.RecordTypeJBCX.equals("1"))
      {
        if ((l < this.recordDays) && (l > -1L))
        {
          this.f_webType = localBundle2.getString("webType");
          Bundle localBundle4 = new Bundle();
          localBundle4.putString("webType", this.f_webType);
          localBundle4.putString("date", this.f_date);
          new DBHelper(this).insertModuleAccess(Global.ManageUserName, Global.getIMEI(this), getResources().getStringArray(2131165195)[0], getResources().getStringArray(2131165195)[1]);
          IntentActivity(this, RecordSoftUrlActivity.class, localBundle4);
          return;
        }
        alertMessage(getString(2131427817) + " " + this.recordDays + " " + getString(2131427812));
        return;
      }
      if ((l < this.imgDays) && (l > -1L))
      {
        Bundle localBundle3 = new Bundle();
        localBundle3.putString("date", this.f_date);
        new DBHelper(this).insertModuleAccess(Global.ManageUserName, Global.getIMEI(this), getResources().getStringArray(2131165196)[0], getResources().getStringArray(2131165196)[1]);
        IntentActivity(this, CapturePicActivity.class, localBundle3);
        return;
      }
      alertMessage(getString(2131427817) + " " + this.imgDays + " " + getString(2131427812));
      return;
    }
    Intent localIntent = new Intent(this, BlackListActivity.class);
    Bundle localBundle1 = new Bundle();
    localBundle1.putString("type", this.RecordTypeJBCX);
    localIntent.putExtras(localBundle1);
    startActivity(localIntent);
  }

  public void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(2130903180);
    init();
    setLissenter();
  }
}

/* Location:           C:\Documents and Settings\Administrator\classes_dex2jar.jar
 * Qualified Name:     com.appwoo.txtws.activity.RecordDateActivity
 * JD-Core Version:    0.6.2
 */